<?php
/*

*/

class group_cometModel extends Model
{
	private $tb='group_comet';
	private $index='msgindex';

	public function getone($gid,$readid)
	{
		$sql="select * from $this->tb where gid=$gid and id>$readid limit 1";
		return $this->db->getRow($sql);
	}
	public function get10($gid,$readid)
	{
		$sql="select * from $this->tb where gid=$gid and id>$readid limit 10";
		return $this->db->getRow($sql);
	}

	public function allnotread($gid,$readid)
	{
		$sql="select * from $this->tb where gid=$gid and id>$readid";
		return $this->db->getAll($sql);
	}

	public function getcount($gid,$readid)
	{
		$sql="select count(*) from $this->tb where gid=$gid and id>$readid";
		return $this->db->getOne($sql);
	}
	public function getcountandmax($gid,$readid)
	{
		$sql="select count(*) as 'count',max(id) as 'maxid' from $this->tb where gid=$gid and id>$readid";
		return $this->db->getRow($sql);
	}

	public function getmaxindex($gid)
	{
		$sql="select max(id) from $this->tb where gid=$gid";
		return $this->db->getOne($sql);
	}

}